@echo off
echo Starting .NET project publish...

REM Check if project file exists
if not exist "hao-Chat.Api.csproj" (
    echo [ERROR] Project file hao-Chat.Api.csproj not found
    pause
    exit /b 1
)

REM Clean previous publish files
if exist "publish" (
    echo Cleaning previous publish files...
    rmdir /s /q "publish"
)

REM Execute publish command
echo Publishing project...
dotnet publish hao-Chat.Api.csproj -c Release -o publish --verbosity minimal

if %errorlevel% equ 0 (
    echo.
    echo [SUCCESS] Project published successfully!
    echo Publish location: publish
    echo.
    echo Published files:
    dir publish /b
) else (
    echo.
    echo [ERROR] Project publish failed!
    pause
    exit /b 1
)

echo.
echo [COMPLETE] Publish finished!
pause